package com.yutel.amote;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import com.yutel.amote.service.AmoteConstant;

public class ApptypeActivity extends Activity implements OnClickListener{
	final String TAG = "AppType";
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.apptype);
		Button btn=(Button)findViewById(R.id.appTypeOK);
		btn.setOnClickListener(this);
				
	}
	@Override
	public void onClick(View v) {
		RadioGroup radioGroup=(RadioGroup)findViewById(R.id.apptype);
		RadioButton rb=(RadioButton)findViewById(radioGroup.getCheckedRadioButtonId());
		String appType=rb.getText().toString();
		Log.d(TAG,"set appType:"+appType);
		AmoteConstant con=AmoteConstant.getInstance(this);
		con.save("appType", rb.getText().toString());
		String client = this.getResources().getString(R.string.clienttype);
		if (client.equals(appType)) {
			Intent intent = new Intent(ApptypeActivity.this,
					ClientCfgActivity.class);
			startActivity(intent);
		} else {
			Intent intent = new Intent(ApptypeActivity.this,
					ServerCfgActivity.class);
			startActivity(intent);
		}
	}
}